import Types from '../actionTypes';

let initState = {
  pageCount: 1,
  returnReviewList: [],
  current: 1,
  viewDetailsData: {}
};

export default (state = initState, action) => {
  const newState = JSON.parse(JSON.stringify(state));
  switch (action.type) {
    case Types.GET_RETURN_REVIEW_LIST:
      newState.returnReviewList = action.data.order;
      newState.pageCount = action.data.pageCount;
      newState.current = Number(action.data.page);
      return newState;
    case Types.VIEW_DETAILS:
      newState.viewDetailsData = action.data;
      return newState;
    default:
      console.log('Types no match in returnReview.js ....');
  }
  return state;
}
